<%include pub/head.html%>
</head>
  <body class="bodybg">
    <div class="xu-index-head bg2" style="overflow: visible">
    	<div class="head-bg4"></div>
    	<div class="container">
	    	<%include pub/nav.html%>
	    </div>
	</div>
    <div class="xu-main-panel">
    	<div class="container">
    		<%if(lessons){%>
    		<input type="hidden" value="<%- lessons._id%>" id="lessons_id" />
    		<div class="row">
    			<div class="xu-video-bar">
    				<h3 class="lessons-title"><%- lessons.title %></h3>
    				<div class="lessons-video-bar">
    					<video src="<%- lessons.src %>" id="xu-video" controls="controls"></video>
    				</div>
    			</div>
    			<div class="xu-video-other">
    				<div class="lessons-right-bar lessons-abstract">
    					<strong>简介：</strong><%- lessons.abstract %>
    				</div>
    				<div class="lessons-right-bar lessons-message">
    					<div class="lessons-message-bar">
    						<strong>课程须知</strong>
    						<p><%- lessons.knowsome %></p>
    					</div>
    					<div class="lessons-message-bar">
    						<strong>你能学到什么？</strong>
    						<p><%- lessons.learnsome %></p>
    					</div>
    				</div>
    			</div>
    		</div>
    		<% } %>
    		<div class="lesson-content-panel">
				<div class="other-words-bar" id="liuyanban">
					<% if(locals.user){ %>
	          <div class="ly-title">
	              <h3>问答评论</h3>
	              <span>请文明发言，相互尊重，互相学习，共建设和谐社区环境</span>
	          </div>
	          <div class="ot-add-comment">
              <div class="po-re">
                  <textarea class="form-control" rows="4" maxlength="140" placeholder="记得保持言论友善和谦虚哦，互相学习，共同进步。"></textarea>
                  <p class="hky-write">还可以输入<span>140</span>个字</p>
              </div>
              <button class="ot-send-btn" disabled="disabled" type="button" id="lot-send-btn">留言</button>
	          </div>
	        <%}else{%>
	        	<div class="ly-title">
              <h3>问答评论</h3>
              <span><a href="javascript:;" data-toggle="modal" data-target="#login">登录</a>之后才能留言哦</span>
	          </div>
	        <%}%>

	        <%if (lcomments){%>
	          <div class="ot-common-words">
	          <%if(locals.user){%>
	          	<% let zan_user_id = locals.user._id;for(let i=0; i<lcomments.length; i++){ 
	              let replyList = lcomments[i].reply, zanNum = lcomments[i].zan,zanList = lcomments[i].zanlist;
	              let hadzan = zanList.indexOf(zan_user_id);
	          	%>
	              <div class="ot-common-item row" id="<%- lcomments[i]._id %>">
	                  <div class="ot-item-left">
	                      <a href=""><img src="<%- lcomments[i].fromid.headimg %>" width="50" height="50"></a>
	                  </div>
	                  <div class="ot-item-content">
	                      <div class="row">
	                          <div class="ot-user-name"><a href="/users/userindex/<%- lcomments[i].toid %>"><%- lcomments[i].fromid.nickname %></a><span class="commenttime"><%- lcomments[i].time %></span></div>
	                          <div class="ot-cont-bottom" uid="<%- lcomments[i].fromid._id %>" cid="<%- lcomments[i]._id %>">
	                              <p class="ot-user-cont"><%- lcomments[i].content %></p>
																	<div class="ot-user-controls">
																	<% if(hadzan !== -1){%>
																	<span class="f-user-zan fw-zan ac"><i class="icon iconfont icon-appreciate_fill_light"></i> <span zannum="<%- zanNum %>"><%- zanNum %></span></span>
																	<%}else{%>
																	<span class="f-user-zan fw-zan"><i class="icon iconfont icon-appreciate_fill_light"></i> <span zannum="<%- zanNum %>"><%- zanNum %></span></span>
																	<%}%>
																	<span class="lot-comment-second"><i class="icon iconfont icon-comment_fill_light"></i> 回复</span>
																	<% if(locals.user._id == lcomments[i].fromid._id){ %>
							                    <span class="lot-comment-delete dismiss" types="flcom"><i class="icon iconfont icon-deletefill"></i> 删除</span>
							                    <%}else{%>
                                  <span class="lot-comment-tip dismiss" types="fltip"><i class="icon iconfont icon-warnfill"></i> 举报</span>
							                    <%}%>
	                              </div>
	                          </div>
	                      </div>

	                      <div class="ot-common-item2">
	                          <% for(let ii=0; ii<replyList.length; ii++){
	                          let szanNum = replyList[ii].zan,
	                              szanList = replyList[ii].zanlist,
	                              shadzan = szanList.indexOf(zan_user_id);
	                          %>
	                          <div class="second-ot-comment row" id="<%- replyList[ii]._id %>">
	                              <div class="ot-item-left">
	                                  <a href=""><img src="<%- replyList[ii].fromid.headimg %>" width="50" height="50"></a>
	                              </div>
	                              <div class="ot-item-content">
	                                  <div class="row">
	                                      <div class="ot-user-name"><a href="/users/userindex/<%- replyList[ii].toid %>"><%- replyList[ii].fromid.nickname %></a><span class="commenttime"><%- replyList[ii].time %></span></div>
	                                      <div class="ot-cont-bottom" uid="<%- replyList[ii].fromid._id %>" cid="<%- lcomments[i]._id %>" tid="<%- replyList[ii]._id %>" >
	                                          <p class="ot-user-cont"><span class="tosome-sp">@<a href="/users/userindex/<%- replyList[ii].toid._id %>"><%- replyList[ii].toid.nickname %></a>：</span><%- replyList[ii].content %></p>
	                                          <div class="ot-user-controls">
	                                              <% if(shadzan !== -1){%>
	                                              <span class="s-user-zan sl-zan ac"><i class="icon iconfont icon-appreciate_fill_light"></i> <span zannum="<%- szanNum %>"><%- szanNum %></span></span>
	                                              <%}else{%>
	                                              <span class="s-user-zan sl-zan"><i class="icon iconfont icon-appreciate_fill_light"></i> <span zannum="<%- szanNum %>"><%- szanNum %></span></span>
	                                              <%}%>
	                                              <span class="lot-comment-second"><i class="icon iconfont icon-comment_fill_light"></i> 回复</span>
	                                              <% if(locals.user._id == replyList[ii].fromid._id){ %>
							                                  <span class="lot-comment-delete dismiss" tid="<%- replyList[ii]._id %>" types="slcom"><i class="icon iconfont icon-deletefill"></i> 删除</span>
							                                  <%}else{%>
							                                  <span class="lot-comment-tip dismiss" tid="<%- replyList[ii]._id %>" types="sltip"><i class="icon iconfont icon-warnfill"></i> 举报</span>
							                                  <%}%>
	                                          </div>
	                                      </div>
	                                  </div>
	                              </div>
	                          </div>
	                          <% } %>
	                      </div>
	                  </div>
	              </div>
	              <%}%>
	          <%}else{%>
	              <%if(lcomments.length == 0){%>
	              <div class="nocomment-bar">
	              	<i class="icon iconfont icon-discover"></i>暂无留言
	              </div>
	              <%}else{%>
	                <% 
	                for(let i=0; i<lcomments.length; i++){ 
	                let replyList = lcomments[i].reply, 
	                    zanNum = lcomments[i].zan,
	                    zanList = lcomments[i].zanlist;
	                %>
	                <div class="ot-common-item row">
	                    <div class="ot-item-left">
	                        <a href=""><img src="<%- lcomments[i].fromid.headimg %>" width="50" height="50"></a>
	                    </div>
	                    <div class="ot-item-content">
	                        <div class="row">
	                            <div class="ot-user-name"><a href="/users/userindex/<%- lcomments[i].toid %>"><%- lcomments[i].fromid.nickname %></a><span class="commenttime"><%- lcomments[i].time %></span></div>
	                            <div class="ot-cont-bottom" uid="<%- lcomments[i].fromid._id %>" cid="<%- lcomments[i]._id %>">
	                                <p class="ot-user-cont"><%- lcomments[i].content %></p>
	                            </div>
	                        </div>

	                        <div class="ot-common-item2">
	                            <% for(let ii=0; ii<replyList.length; ii++){
	                            let szanNum = replyList[ii].zan,
	                                szanList = replyList[ii].zanlist;
	                            %>
	                            <div class="second-ot-comment row">
	                                <div class="ot-item-left">
	                                    <a href=""><img src="<%- replyList[ii].fromid.headimg %>" width="50" height="50"></a>
	                                </div>
	                                <div class="ot-item-content">
	                                    <div class="row">
	                                        <div class="ot-user-name"><a href="/users/userindex/<%- replyList[ii].toid %>"><%- replyList[ii].fromid.nickname %></a><span class="commenttime"><%- replyList[ii].time %></span></div>
	                                        <div class="ot-cont-bottom" uid="<%- replyList[ii].fromid._id %>" cid="<%- lcomments[i]._id %>" tid="<%- replyList[ii]._id %>" >
	                                            <p class="ot-user-cont"><span class="tosome-sp">@<a href="/users/userindex/<%- replyList[ii].toid._id %>"><%- replyList[ii].toid.nickname %></a>：</span><%- replyList[ii].content %></p>
	                                        </div>
	                                    </div>
	                                </div>
	                            </div>
	                            <% } %>
	                        </div>
	                    </div>
	                </div>
	                <%}%>
	              <%}%>
	            <%}%>
	          </div>
	          <% } %>
				</div>
			</div>
    	</div>
    </div>
    <%include pub/foot.html%>
    <div class="modal slide modal-small" id="deleteLcomment" tabindex="-1" role="dialog">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title">提醒</h4>
          </div>
          <div class="modal-body delete-modal-body">
            <input type="hidden" id="ldeletecid-f">
            <input type="hidden" id="ldeletecid-s">
            确认要删除此条评论么？
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-danger" id="delete-lcomf-btn">删除</button>
            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          </div>
        </div>
    	</div>
    </div>
    <div class="modal slide modal-small" id="tipLcomment" tabindex="-1" role="dialog">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">举报原因</h4>
              </div>
              <div class="modal-body delete-modal-body">
                <input type="hidden" id="ltipcid-f">
                <input type="hidden" id="ltipcid-s">
                <textarea class="form-control" rows="4" id="tip-lcomf-val"></textarea>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-danger" id="tip-lcomf-btn">确认举报</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
              </div>
            </div>
        </div>
    </div>
    <%include pub/script.html%>
  </body>
</html>